package com.zzz.gp.utils;



import com.zzz.gp.bean.bo.CommonBo;
import com.zzz.gp.enums.ReturnCodeEnum;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 *  @author: zzz
 *  @date: 2020/5/18 11:16
 */
public class RespUtil {

    public static CommonBo commonResp(String code,String message){
        CommonBo commonBo=new CommonBo(code,message);
        commonBo.setResponseTime(getDateTime());
        return commonBo;
    }


    public static CommonBo commonResp(String code,String message,String bsn){
        CommonBo commonBo=new CommonBo(code,message,bsn);
        commonBo.setResponseTime(getDateTime());
        return commonBo;
    }

    public static CommonBo commonResp(String code,String message,String bsn,Object data){
        CommonBo commonBo=new CommonBo(code,message,bsn,data);
        commonBo.setResponseTime(getDateTime());
        return commonBo;
    }

    public static String getDateTime(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
        String dateTime = LocalDateTime.now().format(formatter);
        return dateTime;
    }

}
